package com.gin.no_gay_alliance.database.entity;

import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.Index;
import androidx.room.PrimaryKey;

import org.jetbrains.annotations.NotNull;

/**
 * 表情使用计数
 *
 * @author : ginstone
 * @version : v1.0.0
 * @since : 2023/9/2 16:05
 **/
@Entity(indices = {@Index(name = "code_unique", value = "code", unique = true)})
public class NgaEmoteCount {
    @PrimaryKey(autoGenerate = true)
    public int id;
    /**
     * 表情code
     */
    @NotNull
    public String code;
    /**
     * 使用次数
     */
    public int count;

    @Ignore
    public NgaEmoteCount(String code) {
        this.code = code;
        this.count = 1;
    }

    public NgaEmoteCount() {
    }

    public void plus() {
        count++;
    }
}
